package com.cspg.ssss.service;


import com.cspg.ssss.domain.GsdgdwjdTemporaryEntity;
import com.cspg.ssss.repository.GsdgdwjdTemporaryMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class GsdgdwjdTemporaryService {
    @Autowired
    private GsdgdwjdTemporaryMapper gsdgdwjdTemporaryMapper;

    public int Add(GsdgdwjdTemporaryEntity gsdgdwjdTemporaryEntity){
        return gsdgdwjdTemporaryMapper.insert(gsdgdwjdTemporaryEntity);
    }

    public List<GsdgdwjdTemporaryEntity> selectDataById(String id){
        return gsdgdwjdTemporaryMapper.selectDataById(id);
    }

   public List<GsdgdwjdTemporaryEntity> selectAll(String id){
       return gsdgdwjdTemporaryMapper.selectAll(id);
    }
   @Transactional(rollbackFor = Exception.class)
    public int batchInsert(List<GsdgdwjdTemporaryEntity> list){
        int c=0;
        try {
             c= gsdgdwjdTemporaryMapper.batchInsert(list);
        }catch (Exception e){
            e.printStackTrace();
        }
        return c;
    }
    @Transactional(rollbackFor = Exception.class)
    public int deleteByList(List<GsdgdwjdTemporaryEntity> list){
        int c=0;
        try {
            c= gsdgdwjdTemporaryMapper.deleteByList(list);
        }catch (Exception e){
            e.printStackTrace();
        }
        return c;
    }
    public int updateData(GsdgdwjdTemporaryEntity record){
        return gsdgdwjdTemporaryMapper.updateData(record);
    }

    public int delete(String id){
        return gsdgdwjdTemporaryMapper.deleteData(id);
    }

    public GsdgdwjdTemporaryEntity selectDataId(String id){
        return gsdgdwjdTemporaryMapper.selectDataId(id);
    }
}
